/*
ID:luongho3
LANG:C++
TASK:contact
*/
#include <iostream>
#include <fstream>

using namespace std;
ifstream fin("contact.in");
ofstream fout("contact.out");

#define MAXL 200001
#define MAX 8200
int A,B,N,bits[MAXL];
int checked[MAX];
string str;
void printBits(int n) {
     int len=0;
     int temp[20];
     while (n>0) {
           ++len;
           temp[len]=n%2;
           n /= 2;           
     }
     int i;
     for (i=len-1;i>=1;--i) {
         fout << temp[i];
     }
}
int main() {
    fin >> A >> B >> N;
    string tmp;
    str = "";
    while (fin>>tmp) {
          str =  str + tmp;
    }
    int i,j,k,c,val;
    for (i=1;i<=str.length();++i) {
        bits[i] = (int)(str[i-1]-'0');
    }
    for (i=1;i<MAX;++i) checked[i]=0;
    for (k=A;k<=B;++k) {
        if (k > str.length()) {
           break;
        }
        val = 0;
        i = 1;
        for (j=k;j>=1;--j) {
            val += (bits[j] * i);
            i *= 2;
        }
        val += i;
        checked[val]++;
        for (j=k+1;j<=str.length();++j) {
            val = val*2 + bits[j];
            val = val % (1<<k);
            val += (1<<k);
            checked[val]++;
        }
    }
    for (i=1;i<=N;++i) {
        j=0;
        c=0;
        for (k=1;k<MAX;++k) {
            if (checked[k] > j) {
               j = checked[k];
               c=1;
            }
            else if (checked[k] == j) {
                 c++;
            }
        }
        if (j==0) break;
        fout << j << "\n";
        int cp=6;
        for (k=1;k<MAX;++k) {
            
            if (checked[k] == j) {
               checked[k] = 0;
               //
               printBits(k);
               --c;
               --cp;
               if (c==0) fout << "\n";
               else {
                    if (cp==0) {
                       fout << "\n";
                       cp=6;
                    }
                    else fout << " ";
               }
            }
        }
    }
    return 0;
}
